package other;

/**
 * ${DESCRIPTION}
 *
 * @author luoyalan
 * @date 2018/12/9
 */
public class Volatile {
    private static volatile Boolean stop = false;

    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            int i = 0;
            while (!stop) {
                i++;
            }
            System.out.println(i);
        });
        thread.start();
        try {
            Thread.sleep(1000);
        } catch (Exception e) {
        }
        stop = true;
    }
}
